package cn.cboard.dao.sql;

import java.sql.ResultSet;
import java.sql.SQLException;

import cn.cboard.database.RowMapper;
import cn.cboard.model.User;
import cn.cboard.model.UserGroup;

public class UserMapper implements RowMapper{
	
	public Object mapRow(ResultSet rs) throws SQLException {
		User user = new User();
		
		user.setUserId(rs.getLong("userId"));
		user.setUsername(rs.getString("username"));
		user.setPassword(rs.getString("password"));
		user.setEmail(rs.getString("email"));
		user.setName(rs.getString("name"));
		user.setSignature(rs.getString("signature"));
		
		UserGroup userGroup = new UserGroup();
		userGroup.setUserGroupId(rs.getLong("usergroupid"));
		user.setUserGroup(userGroup);
		
		return user;
	}

}
